import { Injectable, Pipe,PipeTransform } from '@angular/core';
import { ch_config } from '../providers/language/ch';
import { en_config } from '../providers/language/en';
import { appConfig } from '../providers/config';

@Pipe({
    name: 'i18n'
})
@Injectable()
export class I18N  implements PipeTransform{
    private text: string;
    transform(value: string) {
        switch (appConfig.language) {
            case 'ch':
                this.text = ch_config[value];
                break;
            case 'en':
                this.text = en_config[value];
                break;
            default:
                this.text = ch_config[value];
                break;
        }

        return this.text;
    }
}
